package 晚间作业0310;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Doc09 {
    // 01 02 实战略
    //03
    public static class P03 {
        public static final String TYPE_LAND = "陆生";
        public static final String TYPE_WATER = "水生";

        public enum BornType {
            MAMMALS("哺乳类"), AMPHIBIANS("卵生类");

            private String name;

            BornType(String name) {
                this.name = name;
            }
        }

        public static abstract class Animal {
            //生存类型
            private List<String> type;
            //出生类型
            private BornType born;

            public Animal(List<String> type, BornType born) {
                this.type = type;
                this.born = born;
            }

            public abstract void sayHello();

            public abstract void happy(String action);

            public abstract void mood();
        }

        public static class Dog extends Animal {
            public Dog() {
                super(Collections.singletonList(TYPE_LAND), BornType.MAMMALS);
            }

            @Override
            public void happy(String action) {
                System.out.println("被" + action + ", 旺旺！！");
            }

            @Override
            public void sayHello() {
                System.out.println("摇摇尾巴");
            }

            @Override
            public void mood() {
                System.out.println("呜呜");
            }
        }
        public static class Cat extends Animal {
            public Cat() {
                super(Collections.singletonList(TYPE_LAND), BornType.MAMMALS);
            }

            @Override
            public void happy(String action) {
                System.out.println("被" + action + ", 咕噜咕噜！！");
            }

            @Override
            public void sayHello() {
                System.out.println("喵~");
            }

            @Override
            public void mood() {
                System.out.println("嘶嘶");
            }
        }
        public static class Frog extends Animal {
            public Frog() {
                super(Arrays.asList(TYPE_LAND, TYPE_WATER), BornType.AMPHIBIANS);
            }

            @Override
            public void happy(String action) {
                System.out.println("呱呱呱！！");
            }

            @Override
            public void sayHello() {
                System.out.println("呱呱");
            }

            @Override
            public void mood() {
                System.out.println("纵身入水");
            }
        }

        public static void main(String[] args) {
            Animal dog = new Dog();
            dog.happy("抚摸");
            dog.mood();
            dog.sayHello();

            Animal cat = new Cat();
            cat.happy("抚摸");
            cat.mood();
            cat.sayHello();

            Animal frog = new Frog();
            frog.happy("");
            frog.mood();
            frog.sayHello();
        }
    }
}
